package com.java.controller;

import com.alibaba.fastjson.JSONObject;
import com.java.service.WechatService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/wechat")
@RequiredArgsConstructor
public class WechatController {
    private final WechatService wechatService;

    @GetMapping("/articles")
    public JSONObject getArticles(
            @RequestParam(defaultValue = "0") int offset,
            @RequestParam(defaultValue = "20") int count) {
        return wechatService.getMaterialList("news", offset, count);
    }
} 